import common.HDFSOperator;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.Path;

import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Vector;


/**
 * Created by yeyulong on 2017/4/7.
 */
public class TestHDFS {
    public static void main(String [] argvs) throws URISyntaxException {
        /*
        1. create hdfs operator
        2. list files
        3. output result
         */

//        String file_path = "/tmp/yeyulong";
//        Vector<String> contents = HDFSOperator.ls(file_path);
//        System.out.println("folders or files under " + file_path + " are: ");
//        for (String dirs: contents) {
//            System.out.println(file_path + ": " + dirs);
//        }
        String new_path = "/tmp/yeyulong/testdir";
        boolean ret = HDFSOperator.mkdirs(new_path);

        System.out.println("hdfs mkdirs result is " + ret + ".");

        String old_path = "/tmp/yeyulong/testdir";
        ret = HDFSOperator.delete(new_path);
        System.out.println("hdfs delete result is " + ret + ".");
    }
}
